package com.flight.trans.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.flight.trans.bean.MessageSocketBean;
import com.flight.trans.global.Constant;
import com.flight.trans.util.LogUtils;

/**
 * 消息广播监听
 */
public abstract class CommonReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        switch (intent.getAction()){
            case Constant.MessageReceiver:
                // 消息
                onMessage((MessageSocketBean)intent.getExtras().getSerializable(Constant.INFO));
                break;
            case Constant.RefreshReceiver:
                // 刷新
                onRefresh(intent.getIntExtra(Constant.INFO , 0));
                break;
        }
    }

    public abstract void onMessage(MessageSocketBean messageSocketBean) ;

    public abstract void onRefresh(int count) ;
}
